<?php
class AuthHelper extends AppHelper {
	
	function user($key = null) {
		$this->Session = new CakeSession();
		if ($this->Session->started() && 
			$this->Session->valid(Configure::read('Lil.authSessionKey'))
		) {
			if ($key == null) {
				return array(
					Configure::read('Lil.authModel') => 
						$this->Session->read(Configure::read('Lil.authSessionKey'))
				);
			} else {
				$user = $this->Session->read(Configure::read('Lil.authSessionKey'));
				if (isset($user[$key])) return $user[$key];
			}
		}
		return null;
	}
}
?>